<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>修改绩效信息</title>
</head>
<body>
<fieldset class="layui-elem-field" style='margin: 20px; padding: 20px'>
		<legend>信息维护</legend>
		<div class="layui-field-box">
			<form class="layui-form layui-form-pane" lay-filter='formA'>
				<div class="layui-form-item">
					<label class="layui-form-label">员工编号</label>
					<div class="layui-input-inline">
						<select name='codeEmp'></select>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">项目编号</label>
					<div class="layui-input-inline">
						<select name='codePro'></select>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">评分</label>
					<div class="layui-input-inline">
						<input type="text" name="score"
							placeholder="请输入评分" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input type="button" value='确定' lay-submit lay-filter="upd"class="layui-btn" /> 
						<input type="button" value='重置' class="layui-btn layui-btn-primary" onclick="init()"/>
					</div>
					   <input type="button" value='关闭' class="layui-btn" onclick="toClose()"/>
				</div>
				<input type="hidden" name='action' value='upd' />
				<input type="hidden" name='id'>
			</form>
		</div>
	</fieldset>
	
	<script type="text/javascript">
	//初始化下拉框数据
	empInitSelect();
	function empInitSelect(){
		ajax('/employee',{action:'sel'},'json',function(data){
			console.log(data)
			var html = '<option value=""></option>'
			$.each(data,function(index,element){
				html += '<option value="'+this.code+'">'+this.name+'</option>'
			})
			$("select[name='codeEmp']").html(html);
			form.render();
			init();
		})
	}
	proInitSelect();
	function proInitSelect(){
		ajax('/project',{action:'sel'},'json',function(data){
			console.log(data)
			var html = '<option value=""></option>'
			$.each(data,function(index,element){
				html += '<option value="'+this.code+'">'+this.name+'</option>'
			})
			$("select[name='codePro']").html(html);
			form.render();
			init();
		})
	}
	//init();
	function init(){//回显
		var id = '<%=request.getParameter("id")%>'
		ajax('/score',{id:id,action:'get'},'json',function(data){
			form.val("formA",data);//layui取值赋值
		})
	}
	fromOn('/score', 'submit(upd)', 'text', function(data) {
		if (1 == data) {
			layer.msg("修改成功",toClose)
		} else {
			layer.msg("修改失败")
		}
	})
	</script>


</body>
</html>
